package com.yeban.javase.review.exercise;

import java.io.*;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/27
 */
public class InputStreamReaderReview {

    public static void main(String[] args) {
        try(
                InputStream is = new FileInputStream("src/com/yeban/javase/review/text/file_utf8.txt");
                InputStreamReader isr = new InputStreamReader(is, "UTF-8");
                BufferedReader br = new BufferedReader(isr);

                PrintWriter pw = new PrintWriter("src/com/yeban/javase/review/text/file_gbk.txt","GBK")
        ) {
            // 读
            char[] buf = new char[1024];
            int len;
            String line;
            while((line = br.readLine()) != null) {
                pw.write(line);
            }
            pw.flush();
            System.out.println("✅ 转换完成！");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
